package com.jie.util;

/**
 * Created by 12904 on 2018/8/13.
 */

import java.util.ArrayList;
import java.util.List;

/**
 * XML文件类型
 * @author rwq
 *
 */
public class MyFileFilterXML extends javax.swing.filechooser.FileFilter {

    private List<String> ext=new ArrayList<String>();

    public MyFileFilterXML(){
        ext.add(".XML");
        ext.add(".xml");
    }
    public List<String> getExt() {
        return ext;
    }
    public boolean accept(java.io.File pathname) {
        String fn = pathname.getAbsolutePath().toString();
        if (fn.length() > 4)
            fn = fn.substring(fn.length() - 4, fn.length());
        if (ext.contains(fn)|| pathname.isDirectory())
            return true;
        return false;
    }

    public String getDescription() {
        return "XML文件(*.xml)";
    }
}
